<!DOCTYPE html>
<html lang="ch" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="inc :: header('小区管理新增')" />
</head>
<body>
    <form class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label class="layui-form-label">区域名称:</label>
            <div class="layui-input-inline">
                <input name="name" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">上级区域:</label>
            <div class="layui-input-inline">
                <input name="parentId" class="layui-input" type="hidden">
                <input id="areaTree" class="layui-input" type="text">
            </div>
        </div>
    </form>
    <script>
        layui.config({
            base:'/js/module/'
        }).extend({
            treeSelect:'/treeSelect/treeSelect'
        });
        layui.use(['form','treeSelect'],function () {
            var ts = layui.treeSelect;
            ts.render({
                elem:'#areaTree',
                data:'/ac/getAreaJsonTree',
                type:'get',
                style:{
                    folder:{enable:false},
                    line:{enable: true}
                },
                search:true,
                click:function (data) {
                    var parendId = data.current.id;
                    $("input[name='parentId']").val(parendId);//赋值到隐藏域
                }
            });
        })
    </script>
</body>
</html>